<?php
//Requires connectDB and getDetailsOfItemsInTable
require("dbFunctions.php");

/**
 * Retrieves all details on items in the requested Table. 
 * Valid 'type's are Requestor, Supplier, Room, or Equipment.
 * Validity of parameter is not checked here.
 * This file should be hidden from users using the web interface 
 * and is used to retrieve information from the database.
 *
 * Author: John Gaffney & Steve Gennaoui
 * Date: 11/17/2012
 */

//Get the table name 
$type = $_REQUEST['type'];

//Make sure it's got a value...
if( is_null($type) )
	die("Type is not provided.");

//Returns an associative array of ACTIVE items from the requested table
// or dies if the table name is not valid.
$details = getDetailsOfItemsInTable($type);

//Return the json_encoded version of this array
print( json_encode($details) );

?>
